package com.system.user.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.system.user.dao.UsageDao;
import com.system.user.entity.UsageEntity;
import com.system.user.entityVO.UsageParamVO;
import com.system.user.entityVO.UsageVO;
import com.system.user.service.UsageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("usageService")
public class UsageServiceImpl implements UsageService {

    @Autowired
    private UsageDao usageDao;

    @Override
    public boolean add(String bNumber, double use) {
        if (usageDao.insertUsage(bNumber, use) > 0) {
            return true;
        }
        return false;
    }

    @Override
    public List<UsageVO> findWaterByMonth() {
        return usageDao.selectWaterByMonth();
    }

    @Override
    public List<UsageVO> findLightingByMonth() {
        return usageDao.selectLightingByMonth();
    }

    @Override
    public List<UsageEntity> findByParam(UsageParamVO param) {
        return usageDao.selectByDate(param);
    }
}
